<template>
  <div class="merchandise-management views-container">
    <div class="wlm-table">
         <div class="wlm-table-hearder-btn">
             <div class="wlm-form">
            <div class="wlm-form-header">
                直播设置
            </div>
            <div class="wlm-form-content">
                <!-- ref="platform" :model="formFormatData.formData" :rules="formFormatData.rules" -->
                <el-form ref="platform" :model="formFormatData.formData" size="small" label-width="180px" class="retail-form" label-position="right">
                    <el-form-item label="直播文案">
                        <el-input v-model="formFormatData.formData.prompt_copy"></el-input>
                    </el-form-item>
                    <el-form-item label="图片">
                        <choose-files ref="chooseFiles" :config="chooseCopyrightConfigs" :changeEvt="formFormatFiltersChange"></choose-files>
                        <!-- <div class="form-help">建议尺寸500*400</div> -->
                    </el-form-item>
                </el-form>
            </div>
            </div>
         </div>
    </div>
    <div v-cloak class="wlm-fixed-btn flex-row flex-align-c flex-justify-c">
      <el-button size="small" @click="saveForm" type="primary">保存</el-button>
    </div>
  </div>
</template>

<script>
import { liveSave, getLive } from '@/api/setting'
import ChooseFiles from '@/components/ChooseFiles/index'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Form')],
  name: 'LivelistSet',
  components: {
    ChooseFiles
  },
  data() {
    return {
      chooseCopyrightConfigs: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: false,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'image',
          model: 'img'
        }
      },
      formFormatData: {
        key: ['platform'],
        api: {
          editForm: {
            api: getLive,
            params: {
              always: true
            },
            filters: {
              img: {
                bindInit: ['chooseCopyrightConfigs']
              }
            }
          },
          submitForm: liveSave
        },
        formData: {
          prompt_copy: '',
          image: []
        },
        rules: {

        }
      }
    }
  },
  methods: {
    saveForm() {
      // 保存到你要的那个form值里面
      this.formFormatSubmit()
    }
  }
}
</script>
<style lang="less" scoped>
</style>
